package View;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTable;

import Controllor.DB;
import Model.Apartment;
import Model.Complex;
import Model.Lease;

public class Frame extends JFrame {

	private JPanel contentPane;

	/**
	 * Create the frame.
	 */
	public Frame(DB database) {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 1000, 400);
		contentPane = new JPanel();
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		Leases leases = new Leases(database);
		contentPane.add(leases);	
		database.addObserver(leases);
	}
	
	public void start() {
		setVisible(true);
	}

}
